package com.wzy.validation;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class PhoneValidator implements ConstraintValidator<Phone, String>
{

	@Override
	public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext)
	{
		// 校验逻辑
		String check = "158\\d{8}";
		Pattern regex = Pattern.compile(check);
		Matcher matcher = regex.matcher(value);

		return matcher.matches();
	}
}
